package com.chinabank.dao.impl;

import java.util.List;

import org.hibernate.Session;

import com.chinabank.dao.ReviewDao;
import com.chinabank.model.DemandReport;
import com.chinabank.model.Review;

public class ReviewDaoImpl extends BaseDaoImpl<Review> implements ReviewDao {

	@Override
	public List<Review> getReviews(DemandReport demandReport) {
		Session session = this.getSessionFactory().getCurrentSession();
		String hqlString = "from Review rv where rv.demandReport.id=? "
				+ "order by addDate desc";
		List<Review> reviews = session.createQuery(hqlString)
				.setLong(0, demandReport.getId()).list();
		return reviews;
	}

}
